"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var vue_1 = require("vue");
var data_js_1 = require("./data.js");
var vue_router_1 = require("vue-router");
var router = (0, vue_router_1.useRouter)();
// 当前hover的项ID（上部分）- 初始值设为null，避免默认匹配
var hoveredItem = (0, vue_1.ref)(null);
// 当前激活的项（点击选中）
var activeItem = (0, vue_1.ref)(1);
// 记录下部分当前鼠标悬停的id
var isHoveringId = (0, vue_1.ref)(null);
var bottomMenus = data_js_1.default;
// 当前选中项的children
var currentChildren = (0, vue_1.computed)(function () {
    var active = bottomMenus.find(function (item) { return item.id === activeItem.value; });
    return (active === null || active === void 0 ? void 0 : active.children) || [];
});
// 上部分hover处理 - 直接接收id，避免对象引用问题
var handleHover = function (id) {
    hoveredItem.value = id;
};
// 离开时重置为null
var handleHoverLeave = function () {
    hoveredItem.value = null;
};
// 下部分点击处理
var handleClick = function (item) {
    activeItem.value = item.id;
};
// 下部分hover处理
var handleClickHover = function (id) {
    if (activeItem.value !== id) {
        isHoveringId.value = id;
    }
};
var handleLeaveHover = function () {
    isHoveringId.value = null;
};
var gotoUrl = function (item) {
    if (item.url)
        return router.push(item.url);
};
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
var __VLS_ctx = __assign(__assign({}, {}), {});
var __VLS_elements;
var __VLS_components;
var __VLS_directives;
/** @type {__VLS_StyleScopedClasses['hover-item']} */ ;
/** @type {__VLS_StyleScopedClasses['menu-icon']} */ ;
/** @type {__VLS_StyleScopedClasses['click-item']} */ ;
/** @type {__VLS_StyleScopedClasses['click-item']} */ ;
/** @type {__VLS_StyleScopedClasses['click-item']} */ ;
/** @type {__VLS_StyleScopedClasses['click-item']} */ ;
/** @type {__VLS_StyleScopedClasses['is-active']} */ ;
/** @type {__VLS_StyleScopedClasses['menu-text']} */ ;
/** @type {__VLS_StyleScopedClasses['click-item']} */ ;
/** @type {__VLS_StyleScopedClasses['menu-text']} */ ;
/** @type {__VLS_StyleScopedClasses['hover-menu']} */ ;
/** @type {__VLS_StyleScopedClasses['click-menu']} */ ;
/** @type {__VLS_StyleScopedClasses['hover-menu']} */ ;
/** @type {__VLS_StyleScopedClasses['click-menu']} */ ;
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)(__assign({ class: "tab-nav-container" }));
if (__VLS_ctx.currentChildren) {
    // @ts-ignore
    [currentChildren,];
    __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)(__assign({ class: "hover-menu" }));
    var _loop_1 = function (item) {
        // @ts-ignore
        [currentChildren,];
        __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)(__assign(__assign(__assign(__assign({ onMouseenter: function () {
                var _a = [];
                for (var _i = 0; _i < arguments.length; _i++) {
                    _a[_i] = arguments[_i];
                }
                var $event = _a[0];
                if (!(__VLS_ctx.currentChildren))
                    return;
                __VLS_ctx.handleHover(item.id);
                // @ts-ignore
                [handleHover,];
            } }, { onMouseleave: (__VLS_ctx.handleHoverLeave) }), { onClick: function () {
                var _a = [];
                for (var _i = 0; _i < arguments.length; _i++) {
                    _a[_i] = arguments[_i];
                }
                var $event = _a[0];
                if (!(__VLS_ctx.currentChildren))
                    return;
                __VLS_ctx.gotoUrl(item);
                // @ts-ignore
                [handleHoverLeave, gotoUrl,];
            } }), { key: (item.id) }), { class: "hover-item" }));
        var __VLS_0 = {}.RouterView;
        /** @type {[typeof __VLS_components.RouterView, typeof __VLS_components.routerView, ]} */ ;
        // @ts-ignore
        RouterView;
        // @ts-ignore
        var __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({}));
        var __VLS_2 = __VLS_1.apply(void 0, __spreadArray([{}], __VLS_functionalComponentArgsRest(__VLS_1), false));
        __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)(__assign({ class: "menu-icon" }, { class: ({ 'is-hovered': __VLS_ctx.hoveredItem === item.id }) }));
        // @ts-ignore
        [hoveredItem,];
        __VLS_asFunctionalElement(__VLS_elements.img, __VLS_elements.img)({
            src: (__VLS_ctx.hoveredItem === item.id
                ? item.icon
                : __VLS_ctx.hoveredItem === item.id
                    ? item.hoverimg
                    : item.checkoutimg),
            alt: "菜单图标",
        });
        // @ts-ignore
        [hoveredItem, hoveredItem,];
        __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)(__assign({ class: "menu-text" }));
        (item.name);
    };
    for (var _i = 0, _a = __VLS_getVForSourceType((__VLS_ctx.currentChildren)); _i < _a.length; _i++) {
        var item = _a[_i][0];
        _loop_1(item);
    }
}
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)(__assign({ class: "click-menu" }));
var _loop_2 = function (item) {
    // @ts-ignore
    [bottomMenus,];
    __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)(__assign(__assign(__assign(__assign(__assign({ onClick: function () {
            var _a = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                _a[_i] = arguments[_i];
            }
            var $event = _a[0];
            __VLS_ctx.handleClick(item);
            // @ts-ignore
            [handleClick,];
        } }, { onMouseenter: function () {
            var _a = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                _a[_i] = arguments[_i];
            }
            var $event = _a[0];
            __VLS_ctx.handleClickHover(item.id);
            // @ts-ignore
            [handleClickHover,];
        } }), { onMouseleave: function () {
            var _a = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                _a[_i] = arguments[_i];
            }
            var $event = _a[0];
            __VLS_ctx.handleLeaveHover();
            // @ts-ignore
            [handleLeaveHover,];
        } }), { key: (item.id) }), { class: "click-item" }), { class: ({ 'is-active': __VLS_ctx.activeItem === item.id }) }));
    // @ts-ignore
    [activeItem,];
    __VLS_asFunctionalElement(__VLS_elements.img, __VLS_elements.img)({
        src: (__VLS_ctx.activeItem === item.id
            ? item.icon
            : __VLS_ctx.isHoveringId === item.id
                ? item.hoverimg
                : item.checkoutimg),
        alt: "",
    });
    // @ts-ignore
    [activeItem, isHoveringId,];
    __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)(__assign({ class: "menu-text" }));
    (item.name);
};
for (var _b = 0, _c = __VLS_getVForSourceType((__VLS_ctx.bottomMenus)); _b < _c.length; _b++) {
    var item = _c[_b][0];
    _loop_2(item);
}
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)(__assign({ class: "footer" }));
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)(__assign({ style: {} }));
/** @type {__VLS_StyleScopedClasses['tab-nav-container']} */ ;
/** @type {__VLS_StyleScopedClasses['hover-menu']} */ ;
/** @type {__VLS_StyleScopedClasses['hover-item']} */ ;
/** @type {__VLS_StyleScopedClasses['menu-icon']} */ ;
/** @type {__VLS_StyleScopedClasses['is-hovered']} */ ;
/** @type {__VLS_StyleScopedClasses['menu-text']} */ ;
/** @type {__VLS_StyleScopedClasses['click-menu']} */ ;
/** @type {__VLS_StyleScopedClasses['click-item']} */ ;
/** @type {__VLS_StyleScopedClasses['is-active']} */ ;
/** @type {__VLS_StyleScopedClasses['menu-text']} */ ;
/** @type {__VLS_StyleScopedClasses['footer']} */ ;
var __VLS_export = (await Promise.resolve().then(function () { return require('vue'); })).defineComponent({});
exports.default = {};
